*( QOHUPD.CMD - UPDATE QOH IN INVENTORY FROM TRANSACTIONS )
NEWPAGE
SET MESSAGES OFF
OPEN concomp
SET ERROR MESSAGES OFF
*( SET VARIABLES )
SET VAR vprod TEXT
SET VAR vloc TEXT
SET VAR vunit INTEGER
SET VAR chk TEXT
*( PROCESSING )
LABEL gettran
CLS FROM 11 TO 24
WRITE "    " AT 7 36
WRITE "QUANTITY ON HAND UPDATES" AT 5 27
WRITE "Trans#  Det#   Model  Quantity   Location " AT 9 10
WRITE "------  ----   -----  --------   -------- " AT 10 10
FILLIN vtran USING "Enter transaction number: " AT 7 10
IF vtran FAILS THEN ; GOTO xend ; ENDIF
SET POINTER #2 e2 FOR transd WHERE transid EQ .vtran
WHILE e2 EQ 0 THEN
    SET VAR vdet = detnum, vprod = model, vunit = units IN #2
    SHOW VAR vtran=5 AT 11 10 ; SHOW VAR vdet=3 AT 11 18
    SHOW VAR vprod=6 AT 11 24; SHOW VAR vunit=8 AT 11 32
    LABEL loccode
    WRITE "Enter the location for the product. " AT 15 5
    WRITE "    " AT 11 45
    FILLIN vloc USING "" AT 11 45
    SET VAR chk = location IN prodloc +
      WHERE model = .vprod AND location = .vloc
    IF chk FAILS THEN
       WRITE "Cannot find that location for the product - +
  please reenter. " AT 15 5
       WRITE "Press any key to continue." AT 16 10
       PAUSE
       CLS FROM 15 TO 16
       GOTO loccode
    ENDIF
    SHOW VAR vloc=5 AT 11 45
    CHANGE onhand = ('onhand' - .vunit) IN prodloc +
      WHERE model = .vprod AND location = .vloc
    WRITE "Quantity updated for product " AT 17 5
    SHOW VAR vprod AT 17 34
    NEXT #2 e2
ENDWHILE
GOTO gettran
LABEL xend
CLEAR vprod vloc vunit chk e2 vtran vdet
SET MESSAGES ON
SET ERROR MESSAGES ON
RETURN
